package com.scu.phototabuser.ui.home;

import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.scu.phototabuser.R;
import com.scu.phototabuser.ui.imgtab.ShowLoadingMissionsActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by tianfei on 2017/5/7.
 *
 * 图片下发（获取一组图片的主要界面）
 *
 */

public class MissionFragment extends Fragment implements
        MissionContract.MissionView,View.OnClickListener{


    @BindView(R.id.btn_start_task)
    Button btn_start_task;

    private MissionContract.Presenter mPresenter;


    public static MissionFragment newInstance(){
        return new MissionFragment();
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.fragment_mission,container,false);
        ButterKnife.bind(this,view);

        btn_start_task.setOnClickListener(this);

        return view;
    }

    @Override
    public void onClick(View v) {

        switch (v.getId()){

            case R.id.btn_start_task:

                mPresenter.showMissionView();
                break;


            default:
                break;
        }
    }

    @Override
    public void setPresenter(MissionContract.Presenter mPresenter) {
        this.mPresenter = mPresenter;
    }


    //跳转到imgtab.ShowLoadingMissionsActivity
    @Override
    public void jumpToImgTab(){
        Intent intent=new Intent(getActivity(), ShowLoadingMissionsActivity.class);
        startActivity(intent);
    }

}
